﻿@{
    ViewBag.Title = "RptPosPayDetail";
}

@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
<body>
   <form id="form1" runat="server" method="post" style="height: 100%">
    
    @Html.Partial("~/Views/Modular/ReportsToolbar.cshtml")
    
    <div id = "DivHeader">
        <table>
            <tr>
                <td width = "70px" align="right">时间段：</td>
                <td  width = "230px">
                    @Html.Partial("~/Views/Modular/dxDateTimeRange.cshtml")
                </td>
                <td width = "150px">
                    <input id="comDataType" name="comDataType" class="mini-combobox" style="width:150px;" showNullItem="false" required="true" 
                            allowInput="false" align="left" value ="0" data ="datetype"/> 
                </td>
                <td  width = "70px" align="right">交班单号：</td>
                <td  width = "150px">
                    <input class="mini-textbox" name="FClassNo" style="width:150px; top: 0px; left: 0px;" />
                </td>
            </tr>
        </table>
        <table style="margin-bottom:4px;">
            <tr>
                <td width ="70px" align="right">付款方式：</td>
                <td width ="190px">    
                    @Html.Partial("~/Views/Modular/LookupPayInfo.cshtml")                      
                </td>
                <td width = "70px" align="right">收银员：</td>
                <td width = "190px">
                    @Html.Partial("~/Views/Modular/LookupUserInfo.cshtml")
                </td>
                <td width ="70px" align="right">单据编号：</td>
                <td width ="150px">
                    <input name="FBillNo" class="mini-textbox" style="width:150px;"/>
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" borderStyle="border:1;"pageSize="15"
            url="../Report/GetBillDetail"
            allowCellSelect="true" allowCellEdit="true" showSummaryRow="true" ondrawsummarycell="onDrawSummaryCell"
            fitColumns="false" onrowdblclick="editBill" sortMode="client">
            <div property="columns">
                <div field="FDate" width="130" headerAlign="center" dateFormat="yyyy-MM-dd HH:mm:ss">单据日期</div>
                <div field="FNumber" width="90" headerAlign="center">付款方式编码</div>
                <div field="FName" width="120" headerAlign="center">付款方式名称</div>
                <div field="mFAmount" name="mFAmount" width="90" headerAlign="center"align="right"numberFormat="#,0.00">零售金额</div>
                <div field="mFDepAmount" name="mFDepAmount" width="90" headerAlign="center"align="right"numberFormat="#,0.00">充值金额</div>
                <div field="mFAllAmount" name="mFAllAmount" width="90" headerAlign="center"align="right"numberFormat="#,0.00">合计金额</div>
                <div field="FBillNo" width="120" headerAlign="center">单据编号</div>
                <div field="mFMemberDepositID" width="90" headerAlign="center">会员消费编号</div>
            </div>
        </div>  
    </div>
    
    <script type="text/javascript">
        var datetype = [{ "id": "0", "text": "付款汇总" }, { "id": "1", "text": "付款明细" }];

        mini.parse();
        var form = new mini.Form("form1");
        var grid = mini.get("datagrid1");
        var uID = parent.window.getSystemAppID();
        var hdatatype = getQueryString("datatype");
        var sumFields = "mFAmount,mFDepAmount,mFAllAmount";

        function FormShown() {
            var nowDate = new Date();
            mini.getbyName("FDateTime1").setValue(dateToStr(nowDate, 1));
            mini.getbyName("FDateTime2").setValue(dateToStr(nowDate, 2));
            mini.getbyName("comdatasel").setValue(0);
            LoadData();
        }        

        function clearloca() {
            mini.getbyName("FUserID").setValue("");
            mini.getbyName("FUserID").setText("");
            mini.getbyName("FUserName").setValue("");
            mini.getbyName("FPayID").setValue("");
            mini.getbyName("FPayID").setText("");
            mini.getbyName("FPayName").setValue("");
            mini.getbyName("FClassNo").setValue("");
            mini.getbyName("FBillNo").setValue("");  
        }

        function LoadData() {
            var cDateTime1 = mini.getbyName("FDateTime1").getFormValue();
            var cDateTime2 = mini.getbyName("FDateTime2").getFormValue();
            var mBillNo = mini.getbyName("FBillNo").getValue();
            var mClassNo = mini.getbyName("FClassNo").getValue();
            var mPayID = mini.getbyName("FPayID").getValue();
            var mCasherID = mini.getbyName("FUserID").getValue();
            var mDataType = mini.getbyName("comDataType").getValue();
            if (mini.getbyName("FPayName").getValue() == "") mPayID = "-1";

            var json = "[{";
            json = json + '"mListType":' + '"6",';//列表类型
            json = json + '"mSystemAppID":' + '"' + uID + '",';
            json = json + '"mDateTime1":' + '"' + cDateTime1 + '",';
            json = json + '"mDateTime2":' + '"' + cDateTime2 + '",';
            json = json + '"mCasherID":' + '"' + mCasherID + '",';
            json = json + '"mDataType":' + '"' + mDataType + '",';
            json = json + '"mPayID":' + '"' + mPayID + '",';
            json = json + '"mClassNo":' + '"' + mClassNo + '",';
            json = json + '"mBillNo":' + '"' + mBillNo + '"';
            json = json + "}]";

            grid.load({ mydata: json });

            mExportDataUrl = grid.url;
            mExportDataJson = json;//导出
        }

        function printdata() {
            var url = "../Report/PrintReport";
            mini.open({
                url: url,
                title: "打印", width: 1000, height: 700,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var NoneDisplayCol = [];
                    iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, parent.window.getSystemCompany() + "零售付款方式明细表");
                }
            });
        }

    </script>

    </form>
</body>
